<template>
	<view>
		<view class="button">
			<view class="">
				新增会员
			</view>
		</view>



		<view class="box" v-for="(item,index) in numberlist" :key="index" @click="todetails(item)">
			<view class="left">
				<view class="image">
					<image src="../../static/VIP.png" mode=""></image>
				</view>
				<view class="name">
					{{item.userName}}
				</view>
			</view>
			<view class="right"> 
				<image src="../../static/xiyoujiantou.png" mode=""></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				numberlist: [], //会员列表
			}
		},
		onLoad() {
			this.getnumberlist()
		},
		onShow() {
			this.getnumberlist()
		},
		onPullDownRefresh() {
			this.getnumberlist()
			console.log('refresh');
			setTimeout(function() {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		methods: {
			//会员详情
			todetails(item){
				uni.navigateTo({
					url:"../memberdetails/memberdetails?data=" + JSON.stringify(item) 
				})
			},
			
			//获取会员列表
			getnumberlist() {
				var that = this
				var data = {}
				that.$http("/api/user/store/getMemberStoreId/" + "0", 'POST', data).then((res) => {
					console.log('会员列表', res.data.data.list)
					that.numberlist = res.data.data.list
				})
			},
		}
	}
</script>

<style lang="scss">
	image {
		width: 100%;
		height: 100%;
	}

	.button {
		display: flex;
		justify-content: flex-end;

		view {
			color: #FFFFFF;
			background-color: rgb(35, 149, 255);
			width: 140rpx;
			height: 60rpx;
			border-radius: 50rpx;
			font-size: 28rpx;
			text-align: center;
			line-height: 60rpx;
			margin: 20rpx;
		}

	}

	.box {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 20rpx;
		border-top: 1rpx solid #ECECEC;

		.left {
			display: flex;
			align-items: center;

			.image {
				width: 30rpx;
				height: 30rpx;
				margin-right: 20rpx;
			}
		}

		.right {
			width: 30rpx;
			height: 30rpx;
		}
	}
</style>
